package com.pan.kang.controller;

import com.pan.kang.common.Request;
import com.pan.kang.common.Response;
import com.pan.kang.dto.CreateOrderDto;
import com.pan.kang.security.AuthType;
import com.pan.kang.security.Authorization;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/order")
public class OrderController {


    /**
     * 请求接口入参
     * {
     * "data": {
     * "createOrderDetailDtoList": [
     * {
     * "goodsId": "457b0aaef0044d2cc70227d5e7a134eb",
     * "num": 1,
     * "price": 0.01,
     * "shopId": "7a7da200a3d44fb4a5f03543e0611281",
     * "skuId": "dbfc0ecc683a76664e4d1a9160c5f1d4"
     * }
     * ],
     * "mobile": "13227687610",
     * "payStyle": "ALI_APP"
     * }
     * }
     **/
    @PostMapping("/V1.0/create")
    @Authorization(AuthType.AUTO_USER)
    public Response<String> create(@RequestBody Request<CreateOrderDto> requestBean) {
        String userId = requestBean.getJwtUser().getUserId();
        requestBean.getData().setUserId(userId);
        return new Response<>("创建订单成功！！！", 200);
    }

}
